<%@ Language=VBScript %>
<%Option Explicit%>
<%
Response.Expires=0
%>
<!--#include file="../cons.asp"-->
<!--#include file="../../Common/Database.asp"-->

<%
	Dim rIdMateria, rIdSedeCurso, rIdTrimestre

	rIdMateria = request("IdMateria")
	rIdSedeCurso = request("IdSedeCurso")
	rIdTrimestre = request("IdTrimestre")

%>
<style type="text/css">
	.DivLA{ width:400px; height: 300px; overflow-Y: none;}
</style>
	
<script src="../../js/prototype.js" type="text/javascript"></script>
<script>
	var obj = window.opener.document.all;
</script>

<script>
function setInstallStyles(fOK) {
	document.getElementById("installFailure").runtimeStyle.display = fOK ? "none" : "block";
	document.getElementById("installOK").runtimeStyle.display = fOK ? "block" : "none";
}
function okInstall() {
	setInstallStyles(true);
}
function noInstall() {
	setInstallStyles(false);
}

function viewinit() {
  if (!factory.object) {
  	noInstall();
  	return
  } else {
  okInstall();
  factory.printing.header = ""
  factory.printing.footer = ""
  factory.printing.portrait = false

  // enable control buttons
  var templateSupported = factory.printing.IsTemplateSupported();
  var controls = idControls.all.tags("input");
  for ( i = 0; i < controls.length; i++ ) {
    controls[i].disabled = false;
    if ( templateSupported && controls[i].className == "ie55" )
      controls[i].style.display = "inline";
    }
  }
}


</script>
<!-- MeadCo ScriptX Control -->
<object id="factory" style="display:none" viewastext classid="clsid:1663ED61-23EB-11D2-B92F-008048FDD814" codebase="../../ActiveX/smsx.cab#Version=6,3,435,20">
</object>
<div id="installFailure" style="display: none;">
	<h2>It appears ScriptX is unavailable or has failed to install.</h2>
	<p><b>Has the Infobar appeared?</b></p>
	<p>If you are using Internet Explorer 6 or later on Windows XP SP2 or later then the Explorer Information bar may appear while trying to install ScriptX, it looks like this:</p>
	<p style="padding: 4px"><img src="..\infobar.png"></p>
	<p>If the bar has appeared, follow the instructions: click on the bar and then select <i>Install ActiveX Control...</i></p>
	<p><b>Are you an administrator?</b></p>
	<p>ScriptX is code that requires you have administrator rights on your machine in order to install it successfully.</p>
	<p>If you are not an administrator, please contact your administrator and ask them to install ScriptX for you.</p>
</div>


<div id="installOK" style="display: none;"></div>
<div id=idControls class="noprint"></div>

<div id="Comentario" style="position: relative; top: 40px;font-weight: bold; font-size: 14px; display:;">Imprimiendo Listado...</div>


<body style="margin: 0px;">
<div id="Print" style="margin: 0; display: none;">
<table cellpadding="0" cellspacing="0" width=100% height=100%>
<tr>
	<td align="center" style="font-family: Verdana; font-size: 12px;">
		<%if cint(request("pp")) = 1 then%>
			<b>LISTADO DE PROMEDIOS</b></br>
			Curso: <script>document.write(obj.cmb_Cursos.options[obj.cmb_Cursos.selectedIndex].text);</script></br>
			Materia: <script>document.write(obj.cmbMaterias.firstChild.options[obj.cmbMaterias.firstChild.selectedIndex].text);</script></br>
			Trimestre: <script>document.write(obj.cmb_Trimestres.options[obj.cmb_Trimestres.selectedIndex].text);</script></br></br>
			<div id="divPrint" style="width: 30%; height: 100%;"><script>document.write(opener.document.getElementById("divListadoAlumnos").innerHTML);</script></div>
		<%end if%>
		
		<%if cint(request("pp")) = 2 then%>
			<b>GRAFICO PORCENTAJE DE APROBADOS</b></br>
			Curso: <script>document.write(obj.cmb_Cursos.options[obj.cmb_Cursos.selectedIndex].text);</script></br>
			Materia: <script>document.write(obj.cmbMaterias.firstChild.options[obj.cmbMaterias.firstChild.selectedIndex].text);</script></br>
			Trimestre: <script>document.write(obj.cmb_Trimestres.options[obj.cmb_Trimestres.selectedIndex].text);</script></br></br>
			<div id="Div1" style="width: 30%; height: 100%;"><script>document.write(opener.document.getElementById("divChart").innerHTML);</script></div>
		<%end if%>

		<!-- Listados Procesados -->
		<%if cint(request("pp")) = 3 then%>
			<b>LISTADO DE ALUMNOS</b></br>
			<script>document.write(opener.document.getElementById("TituloListado").innerHTML);</script></br>
			Curso: <script>document.write(obj.cmb_Cursos.options[obj.cmb_Cursos.selectedIndex].text);</script></br>
			<div id="Div2" style="width: 70%; height: 100%;"><br><script>document.write(opener.document.getElementById("divListado").innerHTML);</script></div>
		<%end if%>
	</td>
</tr>
</table>
</div>
</body>


<script>
window.onbeforeprint=beforePrint
window.onafterprint=afterPrint

function beforePrint()
{
	document.getElementById("Print").style.display = "";
	document.getElementById("Comentario").style.display = "none";
}

function afterPrint()
{
	document.getElementById("Print").style.display = "none";
	document.getElementById("Comentario").style.display = "";
	window.close();
}

function PrintPlanilla()
{
	//false = no abre el cuadro de dialogo
	factory.printing.Print(false);
}

function nodisplayprint()
{ 
	for(var i=0;i<document.all.length;i++)
	{ 
		if (document.all[i].id == 'noprint')
			document.all[i].style.display = 'none';
	}
}

nodisplayprint();
PrintPlanilla();

</script>